﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AMS.DataAccess.Sql
{
    /// <summary>
    /// 一个条件表达式构造器接口
    /// </summary>
    internal interface IConditionProvider<T>
    {
        /// <summary>
        /// 添加条件
        /// </summary>
        /// <param name="condition">条件表达式</param>
        T AddCondition(string condition);

        /// <summary>
        /// 添加条件
        /// </summary>
        /// <param name="condition">条件表达式</param>
        T AddCondition(SqlCondition condition);

        /// <summary>
        /// 添加条件
        /// </summary>
        /// <param name="sql">条件表达式的前半部</param>
        /// <param name="sql2">条件表达式的后半部</param>
        T AddCondition(string sql, string sql2);

        /// <summary>
        /// 添加表达式
        /// </summary>
        /// <param name="logicOperator">与现有内容的条件表达式，必需是 AND/OR, 且需要管理空格</param>
        /// <param name="condition">条件</param>
        T AddCondition(string logicOperator, SqlCondition condition);

        /// <summary>
        /// 将对象的主键添加为 where 条件
        /// </summary>
        /// <param name="businessObject">业务对象</param>
        void AddPrimaryKeyFieldAsCondition(object businessObject);

        /// <summary>
        /// 将对象的主键添加为 where 条件
        /// </summary>
        /// <param name="businessObject">业务对象</param>
        /// <param name="objectType">对象的实际类型</param>
        void AddPrimaryKeyFieldAsCondition(object businessObject, Type objectType);
    }
}
